package cn.saltybe.analysis.crawler.wbtc.newHouse;

import cn.saltybe.analysis.crawler.wbtc.common.WbtcHouseImage;
import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.SpiderBean;

import java.util.List;

@Gecco(
        matchUrl = {
                "https://{}.58.com/xinfang/loupan/{id}.html"
        },
        pipelines = { "wbtcNewHousePipeline" },
        downloader = "htmlUnitDownloader")
public class WbtcNewHouse implements SpiderBean {
    @Request
    private HttpRequest request;

    public HttpRequest getRequest() {
        return request;
    }

    public void setRequest(HttpRequest request) {
        this.request = request;
    }

    @RequestParameter
    private String id;

    @Text
    @HtmlField(cssPath = "#container > div.main-detail.mod > div.basic-details > div.basic-parms-wrap > div > div > div.basic-fst > h1")
    private String title;

    @Text
    @HtmlField(cssPath = "#container > div.main-detail.mod > div.basic-details > div.basic-parms-wrap > dl > dd.price > p > label")
    private String label;

    @Text
    @HtmlField(cssPath = "#container > div.main-detail.mod > div.basic-details > div.basic-parms-wrap > dl > dd.price > p > em")
    private String price;

    @Text
    @HtmlField(cssPath = "#container > div.main-detail.mod > div.basic-details > div.basic-parms-wrap > dl > dd.price > p > span")
    private String unit;

    @Text
    @HtmlField(cssPath = "#container > div.main-detail.mod > div.basic-details > div.basic-parms-wrap > dl > dd.last-line.g-overflow > a.lpAddr-text.g-overflow")
    private String address;

    @HtmlField(cssPath = "#j-switch-basic > div.switch-box > div.clip > div > a")
    private List<WbtcHouseImage> image;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<WbtcHouseImage> getImage() {
        return image;
    }

    public void setImage(List<WbtcHouseImage> image) {
        this.image = image;
    }
}
